#!/bin/bash

COLLNAMES=$1

if [ x"$COLLNAMES" == x ]; then
    echo "./$0 collection name"
    exit
fi

if [ x"$COLLNAMES" == x"all" ]; then
   COLLNAMES="shici images content invites"
fi

echo "Back up collection of $COLLNAME"

BASEDIR=/media/v/documents/apps/mongodb/bin/

BACKAPP=$BASEDIR/mongoexport

SAVEPOS=/media/v/documents/db/back/

for c in $COLLNAMES
do
COLLNAME=$c
SAVEFILE=mongo-$COLLNAME.back

EXEC=" $BACKAPP -o $SAVEPOS/$SAVEFILE -c $COLLNAME -d proj"

echo $EXEC
$EXEC
done

echo "Backup done."
